package com.hongye.province.controller;

import java.util.List;

import com.hongye.common.domain.FangCity;
import com.hongye.province.domain.vo.FangCityVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hongye.common.log.annotation.Log;
import com.hongye.common.log.enums.BusinessType;
import com.hongye.common.security.annotation.RequiresPermissions;
import com.hongye.province.service.IFangCityService;
import com.hongye.common.core.web.controller.BaseController;
import com.hongye.common.core.web.domain.AjaxResult;
import com.hongye.common.core.web.page.TableDataInfo;

/**
 * 城市列表Controller
 * 
 * @author ruoyi
 * @date 2025-01-09
 */
@RestController
@RequestMapping("/city")
public class FangCityController extends BaseController
{
    @Autowired
    private IFangCityService fangCityService;

    /**
     * 查询城市列表列表
     */
    @RequiresPermissions("province:city:findCityListByProvinceId")
    @GetMapping("/findCityListByProvinceId")
    public TableDataInfo findCityListByProvinceId(FangCity fangCity)
    {
        startPage();
        List<FangCityVo> list = fangCityService.selectFangCityList(fangCity);
        return getDataTable(list);
    }

    /**
     * 修改城市状态
     */
    @RequiresPermissions("province:city:updateStatusByCityId")
    @Log(title = "城市列表", businessType = BusinessType.UPDATE)
    @PutMapping("/updateStatusByCityId")
    public AjaxResult updateStatusByCityId(@RequestBody FangCity fangCity)
    {
        return toAjax(fangCityService.updateFangCity(fangCity));
    }



//    /**
//     * 修改城市状态
//     */
//    @RequiresPermissions("province:city:edit")
//    @Log(title = "城市列表", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody FangCity fangCity)
//    {
//        return toAjax(fangCityService.updateFangCity(fangCity));
//    }


//    /**
//     * 导出城市列表列表
//     */
//    @RequiresPermissions("province:city:export")
//    @Log(title = "城市列表", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, FangCity fangCity)
//    {
//        List<FangCity> list = fangCityService.selectFangCityList(fangCity);
//        ExcelUtil<FangCity> util = new ExcelUtil<FangCity>(FangCity.class);
//        util.exportExcel(response, list, "城市列表数据");
//    }
//
//    /**
//     * 获取城市列表详细信息
//     */
//    @RequiresPermissions("province:city:query")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Integer id)
//    {
//        return success(fangCityService.selectFangCityById(id));
//    }
//
//    /**
//     * 新增城市列表
//     */
//    @RequiresPermissions("province:city:add")
//    @Log(title = "城市列表", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody FangCity fangCity)
//    {
//        return toAjax(fangCityService.insertFangCity(fangCity));
//    }
//

//
//    /**
//     * 删除城市列表
//     */
//    @RequiresPermissions("province:city:remove")
//    @Log(title = "城市列表", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    public AjaxResult remove(@PathVariable Integer[] ids)
//    {
//        return toAjax(fangCityService.deleteFangCityByIds(ids));
//    }
}
